package com.gec.zhs.controller;

import java.util.List;

import com.gec.zhs.entity.query.SysmessageQuery;
import com.gec.zhs.entity.po.Sysmessage;
import com.gec.zhs.entity.vo.ResponseVO;
import com.gec.zhs.service.SysmessageService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 系统消息表 Controller
 */
@RestController("sysmessageController")
@RequestMapping("/sysmessage")
public class SysmessageController extends ABaseController{

	@Resource
	private SysmessageService sysmessageService;
	/**
	 * 根据条件分页查询
	 */
	@RequestMapping("/loadDataList")
	public ResponseVO loadDataList(SysmessageQuery query){
		return getSuccessResponseVO(sysmessageService.findListByPage(query));
	}

	/**
	 * 新增
	 */
	@RequestMapping("/add")
	public ResponseVO add(Sysmessage bean) {
		sysmessageService.add(bean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增
	 */
	@RequestMapping("/addBatch")
	public ResponseVO addBatch(@RequestBody List<Sysmessage> listBean) {
		sysmessageService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增/修改
	 */
	@RequestMapping("/addOrUpdateBatch")
	public ResponseVO addOrUpdateBatch(@RequestBody List<Sysmessage> listBean) {
		sysmessageService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id查询对象
	 */
	@RequestMapping("/getSysmessageById")
	public ResponseVO getSysmessageById(String id) {
		return getSuccessResponseVO(sysmessageService.getSysmessageById(id));
	}

	/**
	 * 根据Id修改对象
	 */
	@RequestMapping("/updateSysmessageById")
	public ResponseVO updateSysmessageById(Sysmessage bean,String id) {
		sysmessageService.updateSysmessageById(bean,id);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id删除
	 */
	@RequestMapping("/deleteSysmessageById")
	public ResponseVO deleteSysmessageById(String id) {
		sysmessageService.deleteSysmessageById(id);
		return getSuccessResponseVO(null);
	}
}